package com.hnas.eCard.dao.impl;

import java.util.List;

import javax.persistence.Query;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.hnas.core.dao.BaseDaoImpl;
import com.hnas.eCard.dao.MerchantDao;
import com.hnas.eCard.orm.Merchant;

@Component("merchantDao")
public class MerchantDaoImpl extends BaseDaoImpl<Merchant> implements MerchantDao{
	
	private static Logger log = LoggerFactory.getLogger(MerchantDaoImpl.class);

	public MerchantDaoImpl() {
		super(Merchant.class);
	}

	@Override
	public List<Merchant> listAll() {
		String sql = "select * from tbl_merchant_info where is_deleted = 0 order by sort asc";
		Query query = this.entityManager.createNativeQuery(sql, Merchant.class);
		return query.getResultList();
	}

	@Override
	public Merchant findById(String merchantId) {
		return this.find(merchantId);
	}

}
